home *** CD-ROM | disk | FTP | other *** search
Wrap
RRRRWWWWBBBBuuuuffffffffeeeerrrreeeeddddPPPPaaaaggggeeeeHHHHeeeeaaaapppp((((3333CCCC++++++++)))) RRRRWWWWBBBBuuuuffffffffeeeerrrreeeeddddPPPPaaaaggggeeeeHHHHeeeeaaaapppp((((3333CCCC++++++++)))) NNNNaaaammmmeeee RWBufferedPageHeap - Rogue Wave library class SSSSyyyynnnnooooppppssssiiiissss #include <rw/bufpage.h> ((((AAAAbbbbssssttttrrrraaaacccctttt bbbbaaaasssseeee ccccllllaaaassssssss )))) DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn This is an abstract base class that represents an abstract page heap buffered through a set of memory buffers. It inherits from the abstract base class RRRRWWWWVVVViiiirrrrttttuuuuaaaallllPPPPaaaaggggeeeeHHHHeeeeaaaapppp, which represents an abstract page heap. RRRRWWWWBBBBuuuuffffffffeeeerrrreeeeddddPPPPaaaaggggeeeeHHHHeeeeaaaapppp will supply and maintain a set of memory buffers. Specializing classes should supply the actual physical mechanism to swap pages in and out of these buffers by supplying definitions for the pure virtual functions sssswwwwaaaappppIIIInnnn((((RRRRWWWWHHHHaaaannnnddddlllleeee,,,, vvvvooooiiiidddd****)))) and sssswwwwaaaappppOOOOuuuutttt((((RRRRWWWWHHHHaaaannnnddddlllleeee,,,, vvvvooooiiiidddd****)))). The specializing class should also supply appropriate definitions for the public functions aaaallllllllooooccccaaaatttteeee(((()))) and ddddeeeeaaaallllllllooooccccaaaatttteeee((((RRRRWWWWHHHHaaaannnnddddlllleeee)))). For a sample implementation of a specializing class, see class RRRRWWWWDDDDiiiisssskkkkPPPPaaaaggggeeeeHHHHeeeeaaaapppp. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee None PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrr RWBufferedPageHeap(unsigned pgsize, unsigned nbufs=10); Constructs a buffered page heap with page size ppppggggssssiiiizzzzeeee. The number of buffers (each of size ppppggggssssiiiizzzzeeee) that will be allocated on the heap will be nnnnbbbbuuuuffffssss. If there is insufficient memory to satisfy the request, then the state of the resultant object as returned by member function iiiissssVVVVaaaalllliiiidddd(((()))) will be FFFFAAAALLLLSSSSEEEE, otherwise, TTTTRRRRUUUUEEEE. PPPPrrrrooootttteeeecccctttteeeedddd MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss virtual RWBoolean sssswwwwaaaappppIIIInnnn(RWHandle h, void* buf) = 0; virtual RWBoolean sssswwwwaaaappppOOOOuuuutttt(RWHandle, h void* buf) = 0; It is the responsibility of the specializing class to supply definitions for these two pure virtual functions. Function sssswwwwaaaappppOOOOuuuutttt(((()))) should copy the page with handle hhhh from the buffer pointed to by bbbbuuuuffff to the swapping medium. Function sssswwwwaaaappppIIIInnnn(((()))) should copy the page with handle hhhh into the PPPPaaaaggggeeee 1111 RRRRWWWWBBBBuuuuffffffffeeeerrrreeeeddddPPPPaaaaggggeeeeHHHHeeeeaaaapppp((((3333CCCC++++++++)))) RRRRWWWWBBBBuuuuffffffffeeeerrrreeeeddddPPPPaaaaggggeeeeHHHHeeeeaaaapppp((((3333CCCC++++++++)))) buffer pointed to by bbbbuuuuffff. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss virtual RWHandle aaaallllllllooooccccaaaatttteeee() = 0; It is the responsibility of the specializing class to supply a definition for this pure virtual function. The specializing class should allocate a page and return a unique handle for it. It should return zero if it cannot satisfy the request. The size of the page is set by the constructor. virtual ~~~~RRRRWWWWBBBBuuuuffffffffeeeerrrreeeeddddPPPPaaaaggggeeeeHHHHeeeeaaaapppp(); Deallocates all internal buffers. RWBoolean iiiissssVVVVaaaalllliiiidddd(); Returns TTTTRRRRUUUUEEEE if self is in a valid state. A possible reason why the object might not be valid is insufficient memory to allocate the internal buffers. virtual void ddddeeeeaaaallllllllooooccccaaaatttteeee(RWHandle h); Redefined from class RRRRWWWWVVVViiiirrrrttttuuuuaaaallllPPPPaaaaggggeeeeHHHHeeeeaaaapppp. It is never an error to call this function with argument zero. Even though this is not a pure virtual function, it is the responsibility of the specializing class to supply an appropriate definition for this function. All this definition does is release any buffers associated with the handle hhhh. Just as the actual page allocation is done by the specializing class through virtual function aaaallllllllooooccccaaaatttteeee(((()))), so must the actual deallocation be done by overriding ddddeeeeaaaallllllllooooccccaaaatttteeee(((()))). virtual void ddddiiiirrrrttttyyyy(RWHandle h); Redefined from class RRRRWWWWVVVViiiirrrrttttuuuuaaaallllPPPPaaaaggggeeeeHHHHeeeeaaaapppp. virtual void* lllloooocccckkkk(RWHandle h); Redefined from class RRRRWWWWVVVViiiirrrrttttuuuuaaaallllPPPPaaaaggggeeeeHHHHeeeeaaaapppp. PPPPaaaaggggeeee 2222 RRRRWWWWBBBBuuuuffffffffeeeerrrreeeeddddPPPPaaaaggggeeeeHHHHeeeeaaaapppp((((3333CCCC++++++++)))) RRRRWWWWBBBBuuuuffffffffeeeerrrreeeeddddPPPPaaaaggggeeeeHHHHeeeeaaaapppp((((3333CCCC++++++++)))) virtual void uuuunnnnlllloooocccckkkk(RWHandle h); Redefined from class RRRRWWWWVVVViiiirrrrttttuuuuaaaallllPPPPaaaaggggeeeeHHHHeeeeaaaapppp. PPPPaaaaggggeeee 3333